<?php
/**
 * Created by PhpStorm.
 * User: Thai Dac Vinh
 * Date: 9/18/14
 * Time: 8:02 PM
 */
$loading = 'Load on session';
include_once 'vocab.class.php';
// Load or reload vocab
if ((isset($_GET['reload'])) || $is_change_year || (!isset($_SESSION[$session_key]))) {
    $memcache = new Memcache();
    $vocab = $memcache->get("$year");
    $loading = 'Load on cache';
    if (isset($_GET['reload']) || (!$vocab)) {
        $vocab = new GS_TDV_Vocab("$year", $card_info);
        $memcache->set("$year", $vocab);
        $loading = 'Load on remote site';
    }
    if (!isset($_SESSION[$session_key])) $_SESSION[$session_key] = array();
    $_SESSION[$session_key]['vocab'] = serialize($vocab);
}

$vocab = unserialize($_SESSION[$session_key]['vocab']);